package department.service;

import java.sql.SQLException;
import java.util.ArrayList;

import department.dao.DepartmentDAO;
import department.domain.Department;

public class DepartmentService {

	private DepartmentDAO dao;
	private static DepartmentService instance = new DepartmentService();
	
	private DepartmentService(){
		dao = DepartmentDAO.getInstance();
	}
	
	public static DepartmentService getInstance(){
		return instance;
	}
	/**
	 * 부서 등록 메소드
	 * @param department
	 * @throws SQLException
	 */
	public void registerDepartment(Department department) throws SQLException{
		dao.insertDepartment(department);
	}
	/**
	 * 부서 아이디로 부서 삭제 메소드
	 * @param departmentId
	 * @throws SQLException
	 */
	public void removeDepartmentById(String departmentId) throws SQLException{
		dao.deleteDepartmentById(departmentId);
	}
	/**
	 * 부서 수정 메소드
	 * @param department
	 * @throws SQLException
	 */
	public void modifyDepartment(Department department) throws SQLException{
		dao.updateDepartmentById(department);
	}
	/**
	 * 부서 아이디로 부서정보 조회 메소드
	 * @param departmentId
	 * @return
	 * @throws SQLException
	 */
	public Department getDepartmentById(String departmentId) throws SQLException{
		return dao.selectDepartmentById(departmentId);
	}
	/**
	 * 부서 목록 조회 메소드
	 * @return
	 * @throws SQLException
	 */
	public ArrayList<Department> getDepartmentList() throws SQLException{
		return dao.selectDepartmentList();
	}
	
}

























